import request from '../../utils/request';

// 会员认证相关 API

// 会员登录
export const memberLogin = (data: any) => {
    return request({
        url: '/member/api/auth/login',
        method: 'post',
        data
    });
};

// 账号+密码登录
export const loginByAccount = (data: any) => {
    return request({
        url: '/member/api/auth/login/account',
        method: 'post',
        data
    });
};

// Apple OAuth登录
export const loginByApple = (data: any) => {
    return request({
        url: '/member/api/auth/login/apple',
        method: 'post',
        data
    });
};

// Google OAuth登录
export const loginByGoogle = (data: any) => {
    return request({
        url: '/member/api/auth/login/google',
        method: 'post',
        data
    });
};

// 手机号+验证码登录
export const loginByPhone = (data: any) => {
    return request({
        url: '/member/api/auth/login/phone',
        method: 'post',
        data
    });
};

// 会员登出
export const memberLogout = (data: any) => {
    return request({
        url: '/member/api/auth/logout',
        method: 'post',
        data
    });
};

// 获取会员Profile信息
export const getMemberProfile = (memberId: string) => {
    return request({
        url: `/member/api/auth/profile/${memberId}`,
        method: 'get'
    });
};

// 刷新令牌
export const refreshToken = (data: any) => {
    return request({
        url: '/member/api/auth/refresh-token',
        method: 'post',
        data
    });
};

// 手机号注册
export const registerByPhone = (data: any) => {
    return request({
        url: '/member/api/auth/register/phone',
        method: 'post',
        data
    });
};

// 发送验证码
export const sendVerificationCode = (data: any) => {
    return request({
        url: '/member/api/auth/send-verification-code',
        method: 'post',
        data
    });
};

// 验证验证码
export const verifyCode = (data: any) => {
    return request({
        url: '/member/api/auth/verify-code',
        method: 'post',
        data
    });
};
